
 
 F u n c t i o n :   t o D C ( d o m E l e m e n t O r S t r i n g M a r k u p ,   o b j e c t K e y V a l u e M a p ) 
 
 
 
 D e s c r i p t i o n :   C o n v e r t s   a n y   H T M L   s o u r c e   c o d e   s t r i n g   o r   D O M   e l e m e n t   c o n s t r u c t   i n t o   a   r e g i s t e r e d   D C   o b j e c t . 
 
 
 
 R e t u r n s :   D C   O b j e c t . 
 
 
 
 N o t e :   I f   t h e   o b j e c t   b e i n g   c o n v e r t e d   i s   a n   e l e m e n t   a l r e a d y   r e n d e r e d   i n   t h e   D O M ,   a l l   r e q u i s i t   p r o p e r t i e s   w i l l   a u t o m a t i c a l l y   b e   s e t   t o   l o a d   t h e   D C   o b j e c t   a t   t h e   s a m e   l o c a t i o n   i n   t h e   D O M ,   w h i c h   w i l l   r e m a i n   t r u e   e v e n   a f t e r   t h e   D C   o b j e c t   i s   c l o s e d   u s i n g   D C . r e m o v e ( )   o r   D C . r e n d e r ( )   t o   r e r e n d e r   t h e   c o m p o n e n t .   I f   c r e a t i n g   a   n e w   e l e m e n t   u s i n g   a   m a r k u p   s t r i n g   o r   a   n e w   o b j e c t   i n s t a n c e ,   t h e n   a t   m i n i m u m ,   t h e   D C   A P I   p r o p e r t i e s   " r o o t "   o r   " t r i g g e r N o d e "   m u s t   b e   s e t   t o   r e n d e r   t h e   D C   o b j e c t   a t   t h e   s a m e   t i m e .   O t h e r w i s e ,   t h e   n e w   D C   o b j e c t   w i l l   h a v e   t o   b e   e x p l i c i t l y   r e n d e r e d   a f t e r w a r d s   u s i n g   o n e   o f   t h e   r e l e v a n t   D C   A P I   m e t h o d s   f o r   t h i s   p u r p o s e .   T h e   t o D C ( )   f u n c t i o n   a l w a y s   r e t u r n s   a   D C   o b j e c t ,   e v e n   w h e n   c h a i n e d . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   C r e a t e   a   n e w ,   e m p t y   D C   o b j e c t   t h a t   h a s   n o   c u s t o m   c o n t e n t   t o   s t a r t   w i t h . 
 
 v a r   D C   =   $ A . t o D C ( ) ; 
 
 
 
 / /   C r e a t e   a   n e w   D C   o b j e c t   w i t h   c u s t o m i z a t i o n   t h a t   i s   n o t   s p e c i f i c a l l y   a s s o c i a t e d   w i t h   a   D O M   e l e m e n t . 
 
 v a r   D C   =   $ A . t o D C ( { 
 
     / /   O p t i o n a l   D C   A P I   p r o p e r t i e s   a n d   m e t h o d s   h e r e . 
 
 } ) ; 
 
 
 
 / /   C o n v e r t   a   D O M   e l e m e n t   i n t o   a   D C   o b j e c t . 
 
 v a r   D C   =   $ A . t o D C ( d o m E l e m e n t ,   { 
 
     / /   O p t i o n a l   D C   A P I   p r o p e r t i e s   a n d   m e t h o d s   h e r e . 
 
 } ) ; 
 
 
 
 / /   F e t c h   a n   e x t e r n a l   c o n t r o l   a n d   c o n v e r t   i t   i n t o   a   D C   o b j e c t   t o   r e n d e r   w i t h   b e h a v i o r   d e c l a r a t i o n s . 
 
 v a r   D C   =   $ A . t o D C ( " p a t h / r e s o u r c e . p h p ? p a r a m s # E x t e r n a l E l e m e n t I d " ,   { 
 
     r o o t :   ' b o d y ' , 
 
     a p p e n d :   t r u e , 
 
     f o r c e F o c u s :   t r u e , 
 
     a f t e r R e n d e r :   f u n c t i o n ( D C )   { 
 
         / /   D o   s o m e t h i n g . 
 
     } 
 
 } ) ; 
 
 